{% extends "wltheme/base.html" %}
{% load future wenlincms_tags %}

{% block meta_title %}搜索{% endblock %}
{% block title %}搜索{% endblock %}

{% block extra_head %}
    <meta name="robots" content="noindex">
{% endblock %}

{% block breadcrumb_menu %}
    <div class="am-container">
        <ol class="am-breadcrumb">
            <li><a href="/" class="am-icon-home">{{ sitesettings.title }}</a></li>
            <li><a class="am-active">搜索结果</a></li>
        </ol>
    </div>
{% endblock %}

{% block main %}
    {% spaceless %}
        <div class="am-u-md-9 search-result">
            <div class="wl-container">
                {% if isprohibited == "1" %}
                    <div class="wl-banner-paixu">
                        搜索结果&nbsp;<span class="am-badge am-badge-success">0</span>
                        &nbsp;条，&nbsp;&nbsp;&nbsp;&nbsp;搜索关键词为&nbsp;
                        <span class="am-badge am-badge-secondary">0</span>
                    </div>
                    <div id="search-results" class="wl-post-list"
                         style="padding:60px 0 0 50px;font-size: 16px">
                        ⊙﹏⊙阁下的搜索太过频繁，请稍后再试
                        <br><br><br><br><br>
                        喝杯茶，休息一下吧，(*^__^*) 嘻嘻……
                        <br><br><br><br><br>&nbsp;
                    </div>
                {% else %}
                    <div class="wl-banner-paixu">
                        搜索结果&nbsp;<span class="am-badge am-badge-success">{{ page_results.paginator.count }}</span>
                        &nbsp;条，&nbsp;&nbsp;&nbsp;&nbsp;搜索关键词为&nbsp;
                        <span class="am-badge am-badge-secondary">{{ query }}</span>
                    </div>
                    {% if page_results.paginator.count == 0 %}
                        <div id="search-results" class="wl-post-list" style="padding-top: 30px;font-size: 16px">
                            ⊙﹏⊙抱歉，没有搜索到&nbsp;“{{ query }}”&nbsp;的相关结果，我们在努力中！(*^__^*)
                            <br>
                            <br>
                            <br>
                            若您需要查找供需项目，推荐您直接发布，我们会给您智能匹配结果
                        </div>
                    {% else %}
                        {% if request.user.is_authenticated %}
                            <div id="search-results">
                                {% for result in results %}
                                    <div class="wl-post-list">
                                        <h3>
                                            <span style="font-weight: 400">{{ forloop.counter0|add:page_results.start_index }})&nbsp;</span>&nbsp;
                                            <a href="{{ result.get_absolute_url }}" target="_blank"
                                               style="font-weight: 600">{{ result }}</a>
                                        </h3>

                                        <div class="wl-list-detail">{{ result.auto_description|striptags|truncatechars:120|safe }}</div>
                                        <div class="list-footer-meta">
                                            {% if result.keywords_string %}
                                                标签:&nbsp;{{ result.keywords_string|truncatechars:25 }}&nbsp;&nbsp;-
                                                &nbsp;
                                                &nbsp;
                                            {% endif %}
                                            热度:&nbsp;{{ result.view_count }}&nbsp;&nbsp;-&nbsp;&nbsp;
                                            <i class="am-icon-bookmark-o"></i>&nbsp;{{ result.updated|date:"Y-m-j" }}
                                            {% if  result.type %}
                                                &nbsp;&nbsp;-&nbsp;&nbsp;
                                                <i class="am-icon-flask moveicon-4"></i>{{ result.type }}
                                            {% endif %}
                                        </div>
                                    </div>
                                {% endfor %}
                            </div>
                            {% pagination_for page_results %}
                        {% else %}
                            <div id="search-results" class="wl-post-list" style="padding-top: 30px;font-size: 16px">
                                <br>亲，查看搜索结果详情请&nbsp;
                                <a class="am-btn am-btn-secondary am-btn-xs" href="/accounts/login/">&nbsp;登录&nbsp;</a>
                            </div>
                        {% endif %}
                    {% endif %}
                {% endif %}
            </div>
        </div>
    {% endspaceless %}
{% endblock %}

{% block right_panel %}
    <div class="am-u-md-3">
        <div class="right-side-panel">
            <div class="wl-container white-back" id="side-top-btn" style="margin-top: 16px;">
                <a class="am-btn am-btn-secondary" href="/uc/user_org/">注册新企业</a>
                &nbsp;注册新企业, 获取行业新技术成果, 新资金渠道, 高端专家和人才
            </div>
            {% include "wltheme/includes/detail_ad.html" %}
        </div>
    </div>
{% endblock %}
